# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataMigration.V1.Model.SqlServerHomogeneousMigrationJobConfig do
  @moduledoc """
  Configuration for homogeneous migration to Cloud SQL for SQL Server.

  ## Attributes

  *   `backupFilePattern` (*type:* `String.t`, *default:* `nil`) - Required. Pattern that describes the default backup naming strategy. The specified pattern should ensure lexicographical order of backups. The pattern must define one of the following capture group sets: Capture group set #1 yy/yyyy - year, 2 or 4 digits mm - month number, 1-12 dd - day of month, 1-31 hh - hour of day, 00-23 mi - minutes, 00-59 ss - seconds, 00-59 Example: For backup file TestDB_20230802_155400.trn, use pattern: (?.*)_backup_(?\\d{4})(?\\d{2})(?\\d{2})_(?\\d{2})(?\\d{2})(?\\d{2}).trn Capture group set #2 timestamp - unix timestamp Example: For backup file TestDB.1691448254.trn, use pattern: (?.*)\\.(?\\d*).trn or (?.*)\\.(?\\d*).trn
  *   `databaseBackups` (*type:* `list(GoogleApi.DataMigration.V1.Model.SqlServerDatabaseBackup.t)`, *default:* `nil`) - Required. Backup details per database in Cloud Storage.
  *   `promoteWhenReady` (*type:* `boolean()`, *default:* `nil`) - Optional. Promote databases when ready.
  *   `useDiffBackup` (*type:* `boolean()`, *default:* `nil`) - Optional. Enable differential backups.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :backupFilePattern => String.t() | nil,
          :databaseBackups =>
            list(GoogleApi.DataMigration.V1.Model.SqlServerDatabaseBackup.t()) | nil,
          :promoteWhenReady => boolean() | nil,
          :useDiffBackup => boolean() | nil
        }

  field(:backupFilePattern)

  field(:databaseBackups,
    as: GoogleApi.DataMigration.V1.Model.SqlServerDatabaseBackup,
    type: :list
  )

  field(:promoteWhenReady)
  field(:useDiffBackup)
end

defimpl Poison.Decoder,
  for: GoogleApi.DataMigration.V1.Model.SqlServerHomogeneousMigrationJobConfig do
  def decode(value, options) do
    GoogleApi.DataMigration.V1.Model.SqlServerHomogeneousMigrationJobConfig.decode(value, options)
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.DataMigration.V1.Model.SqlServerHomogeneousMigrationJobConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
